//+------------------------------------------------------------------+
//|                                                      pattern.mq4 |
//|                                         Dimitri Rudel 28.10.2013 |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Dimitri Rudel 28.10.2013"
#property link      ""



int p_getSignal(){
   int result = 0;
   result = getStar();
   
   return (result);
}



double getRodSize(int shift){
   return (MathAbs(High[shift] - Low[shift])); 
}

double getBodySize(int shift){
   return (MathAbs(Close[shift] - Open[shift])); 
}

int getStar(){
   int result = 0;
   if(getBodySize(3) > 0){
      if(getBodySize(2) / getBodySize(3) <= 0.33){
         if(getDirection(3) == 0 && Close[1] < Open[3]){
            result = 1;
            Print("SIGNAL");
         }else if(getDirection(3) == 1 && Close[1] > Open[3]){
            result = -1;
            Print("SIGNAL");
         }
      }
   } 
   return (result);  
}

int getDirection(int shift){
   int result = -1;
   if(Close[shift] > Open[shift]){
      result = 0;
   }else if(Close[shift] < Open[shift]){
      result = 1;
   }
   return (result);
}


